//
//  UIFont+customFont.m
//  jiaKaoZhuShou
//
//  Created by 金艺社 on 2018/5/3.
//  Copyright © 2018年 金艺社. All rights reserved.
//

#import "UIFont+customFont.h"

@implementation UIFont (customFont)
+ (UIFont *)customFontOfSize:(CGFloat)fontSize {
    //根据屏幕尺寸判断的设备,然后字体设置为0.8倍
    if (kScreenHeight < 568) {
        fontSize = fontSize * 0.8;
    }
    UIFont *newFont = [UIFont preferredFontForTextStyle : UIFontTextStyleBody];
    UIFontDescriptor *ctfFont = newFont.fontDescriptor;
    NSString *fontString = [ctfFont objectForKey : @"NSFontNameAttribute"];
    //使用 fontWithName 设置字体
    return [UIFont fontWithName:fontString size:fontSize];
}
@end
